package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("开始");
        try {
            //String str =null;
            //System.out.println(str.length());
            String str = "bac";
            System.out.println(str.charAt(6));
        } catch (NullPointerException | StringIndexOutOfBoundsException e) {
            System.out.println("出现了" + e + "异常");
        }catch (Exception e){
            System.out.println("出错了");
        }
        System.out.println("结束");

    }
}
